<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
  <head>
    <title>订单管理</title>
    <jsp:include page="header.jsp"></jsp:include>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style type="text/css">
    	.layui-col-md4 .my-select {
    		width: 80%;
    		height:36px;
    		margin-left: 10px;
    	}
    	#my_table {
    		width: 100%;
    	}
    </style>
  </head>
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">内容管理</a>
        <a>
          <cite>订单管理</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <div class="layui-col-md4">
      		<select name="state" class="my-select" id="my_state">
      		<option value="">选择订单状态</option>
        	  <option value="20">全部订单</option>
        	  <option value="1">未支付</option>
              <option value="2">未审核</option>
              <option value="3">已审核</option>
              <option value="4">未发货</option>
              <option value="5">已发货</option>
              <option value="6">已完成</option>
              <option value="7">已退款</option>
              <option value="8">审核不通过</option>
              <option value="9">待退款</option>
        	 </select>
    	</div>
    	<div class="layui-col-md4">
    	  <form class="layui-form layui-col-md12 x-so">
      	  <input type="text" name="id"  placeholder="请输入订单号" autocomplete="off" class="layui-input">
          <button class="layui-btn" id="my_search"><i class="layui-icon">&#xe615;</i></button>
          </form>
    	</div>
      </div>
      <div id="my_table">
	</div>
    </div>
    <script>
    $(function(){
    	var url="/admin/orderTable";
    	$.get(url,function(data){
    		//console.log(data);
    		$('#my_table').html(data);
    	});
    	var myTime =setInterval('timer()',120*1000);
    });
    $("#my_state option").each(function() { 
		//console.log($(this).val());
		if ($(this).val() == '${vo.state}') { 
		$(this).attr("selected", "selected"); 
		} else{
			
		}
	});
      /*用户-删除*/
      $('#my_search').click(function(){
    	  var state =$("#my_state").val();
    	  var id =this.value;
    	  var url="/admin/orderTable?state="+state+"&id="+id;
    	  $.get(url,function(data){
      		$('#my_table').html(data);
      	});
    	  return false;
      });
      function timer(){
    	var ss =$('#my_state option:selected').val();
    	if(ss==2||ss==''){
    		window.location.reload();
    	}
      	}
    </script>
  </body>

</html>